home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20021006-20030409
/
000305_fdc@columbia.edu_Thu Feb 13 18:10:14 EST 2003.msg
< prev
next >
Wrap
Text File
|
2020-01-01
|
2KB
|
52 lines
Article: 14101 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Dealing with '\' char in strings of file locations
Date: 13 Feb 2003 18:09:33 -0500
Organization: Columbia University
Lines: 35
Message-ID: <b2h8jd$dp7$1@watsol.cc.columbia.edu>
References: <a70f50e.0302121525.7922c8c3@posting.google.com> <a70f50e.0302131451.4fe831f@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1045177775 5205 128.59.39.139 (13 Feb 2003 23:09:35 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 13 Feb 2003 23:09:35 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14101
In article <a70f50e.0302131451.4fe831f@posting.google.com>,
Wes <wesdog@hotmail.com> wrote:
: I have learned alot since my last post... I believe I understand the
: difference between ASSIGN, EVALUATE and DEFINE.
:
: However I am still having trouble getting my mind around parsing UNC
: paths. I have a UNC path "\\myserver\dir\subdir\file.txt" in the same
: location of each line (char 50 through 300 is reserved for the UNC,
: whitespace fills in what isnt used).
:
Let's assume the UNC is stored in a macro (variable) called line, and
that it's left-adjusted in columns 50-300, right-padded by spaces.
assign unc \ftrim(\fsubstr(\m(line),50,250))
This extracts the UNC and trims trailing blanks. Now we can change those
pesky backslashes into harmless "forward" slashes:
assign unc \freplace(\m(unc),\\,/)
Now the \m(unc) value is:
//myserver/dir/subdir/file.txt
Of course all this could be combined into one statement:
assign unc \ftrim(\fsubstr(\freplace(\m(line),\\,/),50,250))
Now to whack off the unwanted parts, you can use:
void \fsplit(\m(unc),&a,/)
asg \%n \fdim(&a)
asg path \&a[\%n-1]/\&a[\%n]
- Frank